package com.xiaoyu.client.adapter.seek;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.xiaoyu.client.R;
import com.xiaoyu.client.model.seek.SeekReplyParam.ChildBean;

import java.util.ArrayList;
import java.util.List;

/**
 * 二级回复列表item适配器
 * Created by jk on 2018/10/15.
 */
public class SeekReplyTwoAdapter extends BaseAdapter {
    private Context mContext;
    private List<ChildBean> mList = new ArrayList<>();

    public SeekReplyTwoAdapter(Context mContext, List<ChildBean> mList) {
        this.mContext = mContext;
        this.mList = mList;
    }

    @Override
    public int getCount() {
        return mList.size();
    }

    @Override
    public ChildBean getItem(int position) {
        return getItem(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    class ViewHolder{
        TextView nickName;
        TextView contentTxt;
    }
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder ;
        if (convertView == null){
            convertView = View.inflate(mContext, R.layout.item_reply_two_level,null);
            holder = new ViewHolder();
            holder.nickName = convertView.findViewById(R.id.item_reply_two_level_nick_name);
            holder.contentTxt = convertView.findViewById(R.id.item_reply_two_level_content);
            convertView.setTag(holder);
        }else {
            holder = (ViewHolder) convertView.getTag();
        }
        holder.nickName.setText(mList.get(position).getNickname()+"：");
        holder.contentTxt.setText(mList.get(position).getSeekreplycontent());
        return convertView;
    }
}

